<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>OpenShoe: sleep.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">OpenShoe
   &#160;<span id="projectnumber">0.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">sleep.h</div>  </div>
</div>
<div class="contents">
<a href="sleep_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00038"></a>00038 <span class="preprocessor">#ifndef SLEEP_H</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#define SLEEP_H</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00043"></a>00043 <span class="preprocessor">#endif</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span>
<a name="l00045"></a>00045 <span class="preprocessor">#include &lt;<a class="code" href="compiler_8h.html" title="Compiler file for AVR32.">compiler.h</a>&gt;</span>
<a name="l00046"></a>00046 
<a name="l00047"></a>00047 <span class="preprocessor">#ifndef AVR32_PM_SMODE_GMCLEAR_MASK</span>
<a name="l00048"></a><a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">00048</a> <span class="preprocessor"></span><span class="preprocessor">#define AVR32_PM_SMODE_GMCLEAR_MASK      0x80</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#warning Define already present in the system toolchain header files!</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span>
<a name="l00067"></a>00067 <span class="preprocessor">#if defined(__DOXYGEN__)</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span>
<a name="l00072"></a>00072 <span class="preprocessor">#endif</span>
<a name="l00073"></a>00073 <span class="preprocessor"></span>
<a name="l00074"></a>00074 <span class="preprocessor">#if (UC3A || UC3B)  // For AVR UC3 A0/A1, UC3 B, UC3 A3 series</span>
<a name="l00075"></a>00075 <span class="preprocessor"></span>
<a name="l00076"></a>00076 <span class="preprocessor"># ifndef AVR32_PM_SMODE_DEEPSTOP</span>
<a name="l00077"></a>00077 <span class="preprocessor"></span><span class="preprocessor">#  define AVR32_PM_SMODE_DEEPSTOP          0x00000004</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span><span class="preprocessor"># endif</span>
<a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor"># include &quot;pm.h&quot;</span>
<a name="l00080"></a>00080 <span class="preprocessor">#elif UC3C          // For AVR UC3 C series</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor"># include &quot;<a class="code" href="pm__uc3c_8h.html" title="Power Manager(PM) driver interface.">pm_uc3c.h</a>&quot;</span>
<a name="l00082"></a>00082 <span class="preprocessor">#elif UC3D          // For AVR UC3 D series</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor"># include &quot;pm_uc3d.h&quot;</span>
<a name="l00084"></a>00084 <span class="preprocessor">#elif UC3L          // For AVR UC3 L series</span>
<a name="l00085"></a>00085 <span class="preprocessor"></span><span class="preprocessor"># include &quot;pm_uc3l.h&quot;</span>
<a name="l00086"></a>00086 <span class="preprocessor">#else           </span>
<a name="l00087"></a>00087 <span class="preprocessor"></span><span class="preprocessor"># error Unsupported AVR UC3 series.</span>
<a name="l00088"></a>00088 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00089"></a>00089 <span class="preprocessor"></span>
<a name="l00090"></a>00090 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> pm_sleep(<span class="keywordtype">int</span> sleep_mode)
<a name="l00091"></a>00091 {
<a name="l00092"></a>00092         <span class="keywordflow">switch</span> (sleep_mode) {
<a name="l00093"></a>00093         <span class="keywordflow">case</span> AVR32_PM_SMODE_IDLE:
<a name="l00094"></a>00094                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(AVR32_PM_SMODE_IDLE);
<a name="l00095"></a>00095                 <span class="keywordflow">break</span>;
<a name="l00096"></a>00096         <span class="keywordflow">case</span> <a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_IDLE:
<a name="l00097"></a>00097                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(<a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_IDLE);
<a name="l00098"></a>00098                 <span class="keywordflow">break</span>;
<a name="l00099"></a>00099         <span class="keywordflow">case</span> AVR32_PM_SMODE_FROZEN:
<a name="l00100"></a>00100                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(AVR32_PM_SMODE_FROZEN);
<a name="l00101"></a>00101                 <span class="keywordflow">break</span>;
<a name="l00102"></a>00102         <span class="keywordflow">case</span> <a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_FROZEN:
<a name="l00103"></a>00103                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(<a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_FROZEN);
<a name="l00104"></a>00104                 <span class="keywordflow">break</span>;
<a name="l00105"></a>00105         <span class="keywordflow">case</span> AVR32_PM_SMODE_STANDBY:
<a name="l00106"></a>00106                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(AVR32_PM_SMODE_STANDBY);
<a name="l00107"></a>00107                 <span class="keywordflow">break</span>;
<a name="l00108"></a>00108         <span class="keywordflow">case</span> <a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_STANDBY:
<a name="l00109"></a>00109                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(<a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_STANDBY);
<a name="l00110"></a>00110                 <span class="keywordflow">break</span>;
<a name="l00111"></a>00111         <span class="keywordflow">case</span> AVR32_PM_SMODE_STOP:
<a name="l00112"></a>00112                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(AVR32_PM_SMODE_STOP);
<a name="l00113"></a>00113                 <span class="keywordflow">break</span>;
<a name="l00114"></a>00114         <span class="keywordflow">case</span> <a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_STOP:
<a name="l00115"></a>00115                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(<a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_STOP);
<a name="l00116"></a>00116                 <span class="keywordflow">break</span>;
<a name="l00117"></a>00117         <span class="keywordflow">case</span> AVR32_PM_SMODE_DEEPSTOP:
<a name="l00118"></a>00118                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(AVR32_PM_SMODE_DEEPSTOP);
<a name="l00119"></a>00119                 <span class="keywordflow">break</span>;
<a name="l00120"></a>00120         <span class="keywordflow">case</span> <a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_DEEPSTOP:
<a name="l00121"></a>00121                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(<a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_DEEPSTOP);
<a name="l00122"></a>00122                 <span class="keywordflow">break</span>;
<a name="l00123"></a>00123         <span class="keywordflow">case</span> AVR32_PM_SMODE_STATIC:
<a name="l00124"></a>00124                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(AVR32_PM_SMODE_STATIC);
<a name="l00125"></a>00125                 <span class="keywordflow">break</span>;
<a name="l00126"></a>00126         <span class="keywordflow">case</span> <a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_STATIC:
<a name="l00127"></a>00127                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(<a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_STATIC);
<a name="l00128"></a>00128                 <span class="keywordflow">break</span>;
<a name="l00129"></a>00129 <span class="preprocessor">#if UC3L</span>
<a name="l00130"></a>00130 <span class="preprocessor"></span>        <span class="keywordflow">case</span> AVR32_PM_SMODE_SHUTDOWN:
<a name="l00131"></a>00131                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(AVR32_PM_SMODE_SHUTDOWN);
<a name="l00132"></a>00132                 <span class="keywordflow">break</span>;
<a name="l00133"></a>00133         <span class="keywordflow">case</span> <a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_SHUTDOWN:
<a name="l00134"></a>00134                 <a class="code" href="pm__uc3c_8h.html#ac11cc59a43dd9ec6b7fb43580453eff7" title="Sets the MCU in the specified sleep mode.">SLEEP</a>(<a class="code" href="sleep_8h.html#ae3781b77d6e4988416907e70d197616b">AVR32_PM_SMODE_GMCLEAR_MASK</a> | AVR32_PM_SMODE_SHUTDOWN);
<a name="l00135"></a>00135                 <span class="keywordflow">break</span>;
<a name="l00136"></a>00136 <span class="preprocessor">#endif</span>
<a name="l00137"></a>00137 <span class="preprocessor"></span>        <span class="keywordflow">default</span>:
<a name="l00138"></a>00138                 <span class="keywordflow">break</span>;
<a name="l00139"></a>00139         }
<a name="l00140"></a>00140 }
<a name="l00141"></a>00141 
<a name="l00142"></a>00142 
<a name="l00144"></a>00144 
<a name="l00145"></a>00145 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00146"></a>00146 <span class="preprocessor"></span>}
<a name="l00147"></a>00147 <span class="preprocessor">#endif</span>
<a name="l00148"></a>00148 <span class="preprocessor"></span>
<a name="l00149"></a>00149 <span class="preprocessor">#endif </span><span class="comment">/* SLEEP_H */</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Mon Dec 19 2011 21:04:51 for OpenShoe by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
